![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
@spectrum-web-components/popover
Advanced tools
An `<sp-popover>` is used to display transient content (menus, options, additional actions etc.) and appears when clicking/tapping on a source (tools, buttons, etc.) It stands out via its visual style (stroke and drop shadow) and floats on top of the rest
An <sp-popover>
is used to display transient content (menus, options, additional actions etc.) and appears when clicking/tapping on a source (tools, buttons, etc.) It stands out via its visual style (stroke and drop shadow) and floats on top of the rest of the interface. This component does not implement the actual overlay behavior and interactions. This is handled by the Overlay
system.
yarn add @spectrum-web-components/popover
Import the side effectful registration of <sp-popover>
via:
import '@spectrum-web-components/popover/sp-popover.js';
When looking to leverage the Popover
base class as a type and/or for extension purposes, do so via:
import { Popover } from '@spectrum-web-components/popover';
<div
style="
color: var(--spectrum-gray-800);
height: 200px;
position: relative;
width: 320px;
max-width: 100%;
"
>
<sp-popover dialog open style="--spectrum-popover-dialog-min-width: 0;">
<div
style="
font-size: 18px;
font-weight: 700;
padding-bottom: 30px;
"
>
Popover title
</div>
<div style="font-size: 14px">
Cupcake ipsum dolor sit amet jelly beans. Chocolate jelly caramels.
Icing soufflé chupa chups donut cheesecake. Jelly-o chocolate cake
sweet roll cake danish candy biscuit halvah
</div>
</sp-popover>
</div>
Default popover with no tip and no placement. Popovers will fill up the space of they're containing element by default. The default popover has no padding by default
<div
style="
color: var(--spectrum-gray-800);
height: 200px;
position: relative;
width: 320px;
max-width: 100%;
"
>
<sp-popover
variant="default"
open
style="max-width: 320px; --spectrum-popover-dialog-min-width: 0;"
>
<div style="font-size: 14px; padding: 10px">
<div
style="
font-size: 18px;
font-weight: 700;
padding-bottom: 30px;
"
>
Popover title
</div>
<div style="font-size: 14px">
Cupcake ipsum dolor sit amet jelly beans. Chocolate jelly
caramels. Icing soufflé chupa chups donut cheesecake. Jelly-o
chocolate cake sweet roll cake danish candy biscuit halvah
</div>
</div>
</sp-popover>
</div>
Popovers with padding, ideal for dialogs.
<div
style="
color: var(--spectrum-gray-800);
height: 200px;
position: relative;
width: 320px;
max-width: 100%;
"
>
<sp-popover dialog open style="--spectrum-popover-dialog-min-width: 0;">
<div
style="
font-size: 18px;
font-weight: 700;
padding-bottom: 30px;
"
>
Popover title
</div>
<div style="font-size: 14px">
Cupcake ipsum dolor sit amet jelly beans. Chocolate jelly caramels.
Icing soufflé chupa chups donut cheesecake. Jelly-o chocolate cake
sweet roll cake danish candy biscuit halvah
</div>
</sp-popover>
</div>
<div
style="
color: var(--spectrum-gray-800);
height: 200px;
position: relative;
width: 320px;
max-width: 100%;
"
>
<sp-popover
dialog
placement="bottom"
tip
open
style="--spectrum-popover-dialog-min-width: 0;"
>
<div
style="
font-size: 18px;
font-weight: 700;
padding-bottom: 30px;
"
>
Popover title
</div>
<div style="font-size: 14px">
Cupcake ipsum dolor sit amet jelly beans. Chocolate jelly caramels.
Icing soufflé chupa chups donut cheesecake. Jelly-o chocolate cake
sweet roll cake danish candy biscuit halvah
</div>
</sp-popover>
</div>
<div
style="
color: var(--spectrum-gray-800);
height: 200px;
position: relative;
width: 320px;
max-width: 100%;
"
>
<sp-popover
dialog
placement="top"
tip
open
style="--spectrum-popover-dialog-min-width: 0;"
>
<div
style="
font-size: 18px;
font-weight: 700;
padding-bottom: 30px;
"
>
Popover title
</div>
<div style="font-size: 14px">
Cupcake ipsum dolor sit amet jelly beans. Chocolate jelly caramels.
Icing soufflé chupa chups donut cheesecake. Jelly-o chocolate cake
sweet roll cake danish candy biscuit halvah
</div>
</sp-popover>
</div>
<div
style="
color: var(--spectrum-gray-800);
height: 200px;
position: relative;
width: 320px;
max-width: 100%;
"
>
<sp-popover
dialog
placement="left"
tip
open
style="--spectrum-popover-dialog-min-width: 0;"
>
<div
style="
font-size: 18px;
font-weight: 700;
padding-bottom: 30px;
"
>
Popover title
</div>
<div style="font-size: 14px">
Cupcake ipsum dolor sit amet jelly beans. Chocolate jelly caramels.
Icing soufflé chupa chups donut cheesecake. Jelly-o chocolate cake
sweet roll cake danish candy biscuit halvah
</div>
</sp-popover>
</div>
<div
style="
color: var(--spectrum-gray-800);
height: 200px;
position: relative;
width: 320px;
max-width: 100%;
"
>
<sp-popover
dialog
placement="right"
tip
open
style="--spectrum-popover-dialog-min-width: 0;"
>
<div
style="
font-size: 18px;
font-weight: 700;
padding-bottom: 30px;
"
>
Popover title
</div>
<div style="font-size: 14px">
Cupcake ipsum dolor sit amet jelly beans. Chocolate jelly caramels.
Icing soufflé chupa chups donut cheesecake. Jelly-o chocolate cake
sweet roll cake danish candy biscuit halvah
</div>
</sp-popover>
</div>
0.31.0 (2023-05-17)
FAQs
An `<sp-popover>` is used to display transient content (menus, options, additional actions etc.) and appears when clicking/tapping on a source (tools, buttons, etc.) It stands out via its visual style (stroke and drop shadow) and floats on top of the rest
The npm package @spectrum-web-components/popover receives a total of 3,943 weekly downloads. As such, @spectrum-web-components/popover popularity was classified as popular.
We found that @spectrum-web-components/popover demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.